// 通过函数调用继续返回函数的形式
function sum(a,b,b) {
    return a+b+c
}

function klhAdd(...args){
    let all = 0
    for(let i in args){
        all += i
    }

}
function curring(fn,length) {
    length = length || fn.length
    return function (...args) {
      if (args.length >= length){
        return fn(...args)
      }
      return curring(fn.bind(null,...args),length-args.length)
    }
  }
  function add() {
    var sum = 0
    for (let i = 0; i < arguments.length; i++) {
      sum+=arguments[i]
    }
    return sum
  }
  add=curring(add,6)//参数2为调用add方法所有柯里化参数总和
  console.log(add(1,2,3)(4)(5)(6))//21
